home *** CD-ROM | disk | FTP | other *** search
/ Apple WWDC 1996 / WWDC96_1996 (CD).toast / Technology Materials / MacOS 8 Resources / Developer Tools / Mac OS 8 Interfaces & Libraries / Interfaces / PInterfaces / Terminals.p < prev    next >
Text File  |  1996-05-01  |  12KB  |  344 lines

  1. {
  2.      File:        Terminals.p
  3.  
  4.      Contains:    Communications Toolbox Terminal tool Interfaces.
  5.  
  6.      Version:    Technology:    System 7.5
  7.                  Release:    Universal Interfaces 3.0d3 on Copland DR1
  8.  
  9.      Copyright:    © 1984-1996 by Apple Computer, Inc.  All rights reserved.
  10.  
  11.      Bugs?:        If you find a problem with this file, send the file and version
  12.                  information (from above) and the problem description to:
  13.  
  14.                      Internet:    apple.bugs@applelink.apple.com
  15.                      AppleLink:    APPLE.BUGS
  16.  
  17. }
  18. {$IFC UNDEFINED UsingIncludes}
  19. {$SETC UsingIncludes := 0}
  20. {$ENDC}
  21.  
  22. {$IFC NOT UsingIncludes}
  23.  UNIT Terminals;
  24.  INTERFACE
  25. {$ENDC}
  26.  
  27. {$IFC UNDEFINED __TERMINALS__}
  28. {$SETC __TERMINALS__ := 1}
  29.  
  30. {$I+}
  31. {$SETC TerminalsIncludes := UsingIncludes}
  32. {$SETC UsingIncludes := 1}
  33.  
  34. {$IFC UNDEFINED __DIALOGS__}
  35. {$I Dialogs.p}
  36. {$ENDC}
  37. {$IFC UNDEFINED __CTBUTILITIES__}
  38. {$I CTBUtilities.p}
  39. {$ENDC}
  40. {$IFC UNDEFINED __CONNECTIONS__}
  41. {$I Connections.p}
  42. {$ENDC}
  43.  
  44. {$PUSH}
  45. {$ALIGN MAC68K}
  46. {$LibExport+}
  47.  
  48. {$IFC FOR_SYSTEM7_ONLY }
  49.  
  50. CONST
  51.                                                                 {  current Terminal Manager version      }
  52.     curTMVersion                = 2;                            {  current Terminal Manager Environment Record version      }
  53.     curTermEnvRecVers            = 0;                            {  error codes     }
  54.     tmGenericError                = -1;
  55.     tmNoErr                        = 0;
  56.     tmNotSent                    = 1;
  57.     tmEnvironsChanged            = 2;
  58.     tmNotSupported                = 7;
  59.     tmNoTools                    = 8;
  60.  
  61.  
  62. TYPE
  63.     TMErr                                = OSErr;
  64.  
  65. CONST
  66.     tmInvisible                    = $01;
  67.     tmSaveBeforeClear            = $02;
  68.     tmNoMenus                    = $04;
  69.     tmAutoScroll                = $08;
  70.     tmConfigChanged                = $10;
  71.  
  72.  
  73. TYPE
  74.     TMFlags                                = LONGINT;
  75.  
  76. CONST
  77.     selTextNormal                = $01;
  78.     selTextBoxed                = $02;
  79.     selGraphicsMarquee            = $04;
  80.     selGraphicsLasso            = $08;
  81.     tmSearchNoDiacrit            = $0100;
  82.     tmSearchNoCase                = $0200;
  83.  
  84.  
  85. TYPE
  86.     TMSearchTypes                        = INTEGER;
  87.     TMSelTypes                            = INTEGER;
  88.  
  89. CONST
  90.     cursorText                    = 1;
  91.     cursorGraphics                = 2;
  92.  
  93.  
  94. TYPE
  95.     TMCursorTypes                        = INTEGER;
  96.  
  97. CONST
  98.     tmTextTerminal                = $01;
  99.     tmGraphicsTerminal            = $02;
  100.  
  101.  
  102. TYPE
  103.     TMTermTypes                            = INTEGER;
  104.     TermDataBlockPtr = ^TermDataBlock;
  105.     TermDataBlock = RECORD
  106.         flags:                    TMTermTypes;
  107.         theData:                Handle;
  108.         auxData:                Handle;
  109.         reserved:                LONGINT;
  110.     END;
  111.  
  112.     TermDataBlockH                        = ^TermDataBlockPtr;
  113.     TermDataBlockHandle                    = ^TermDataBlockPtr;
  114.     TermEnvironRecPtr = ^TermEnvironRec;
  115.     TermEnvironRec = RECORD
  116.         version:                INTEGER;
  117.         termType:                TMTermTypes;
  118.         textRows:                INTEGER;
  119.         textCols:                INTEGER;
  120.         cellSize:                Point;
  121.         graphicSize:            Rect;
  122.         slop:                    Point;
  123.         auxSpace:                Rect;
  124.     END;
  125.  
  126.     TermEnvironPtr                        = ^TermEnvironRec;
  127.     TMSelectionPtr = ^TMSelection;
  128.     TMSelection = RECORD
  129.         CASE INTEGER OF
  130.         0: (
  131.             selRect:            Rect;
  132.             );
  133.         1: (
  134.             selRgnHandle:        RgnHandle;
  135.             );
  136.     END;
  137.  
  138.     TermRecordPtr = ^TermRecord;
  139.     TermPtr                                = ^TermRecord;
  140.     TermHandle                            = ^TermPtr;
  141.     TerminalSendProcPtr = ProcPtr;  { FUNCTION TerminalSend(thePtr: Ptr; theSize: LONGINT; refCon: LONGINT; flags: CMFlags): LONGINT; }
  142.  
  143.     TerminalBreakProcPtr = ProcPtr;  { PROCEDURE TerminalBreak(duration: LONGINT; refCon: LONGINT); }
  144.  
  145.     TerminalCacheProcPtr = ProcPtr;  { FUNCTION TerminalCache(refCon: LONGINT; theTermData: TermDataBlockPtr): LONGINT; }
  146.  
  147.     TerminalSearchCallBackProcPtr = ProcPtr;  { PROCEDURE TerminalSearchCallBack(hTerm: TermHandle; refNum: INTEGER; VAR foundRect: Rect); }
  148.  
  149.     TerminalClikLoopProcPtr = ProcPtr;  { FUNCTION TerminalClikLoop(refCon: LONGINT): BOOLEAN; }
  150.  
  151.     TerminalEnvironsProcPtr = ProcPtr;  { FUNCTION TerminalEnvirons(refCon: LONGINT; VAR theEnvirons: TermEnvironRec): CMErr; }
  152.  
  153.     TerminalChooseIdleProcPtr = ProcPtr;  { PROCEDURE TerminalChooseIdle; }
  154.  
  155.     TerminalToolDefProcPtr = ProcPtr;  { FUNCTION TerminalToolDef(hTerm: TermHandle; msg: INTEGER; p1: LONGINT; p2: LONGINT; p3: LONGINT): LONGINT; }
  156.  
  157.     TerminalSendUPP = UniversalProcPtr;
  158.     TerminalBreakUPP = UniversalProcPtr;
  159.     TerminalCacheUPP = UniversalProcPtr;
  160.     TerminalSearchCallBackUPP = UniversalProcPtr;
  161.     TerminalClikLoopUPP = UniversalProcPtr;
  162.     TerminalEnvironsUPP = UniversalProcPtr;
  163.     TerminalChooseIdleUPP = UniversalProcPtr;
  164.     TerminalToolDefUPP = UniversalProcPtr;
  165. {     TMTermTypes      }
  166.     TermRecord = RECORD
  167.         procID:                    INTEGER;
  168.         flags:                    TMFlags;
  169.         errCode:                TMErr;
  170.         refCon:                    LONGINT;
  171.         userData:                LONGINT;
  172.         defProc:                TerminalToolDefUPP;
  173.         config:                    Ptr;
  174.         oldConfig:                Ptr;
  175.         environsProc:            TerminalEnvironsUPP;
  176.         reserved1:                LONGINT;
  177.         reserved2:                LONGINT;
  178.         tmPrivate:                Ptr;
  179.         sendProc:                TerminalSendUPP;
  180.         breakProc:                TerminalBreakUPP;
  181.         cacheProc:                TerminalCacheUPP;
  182.         clikLoop:                TerminalClikLoopUPP;
  183.         owner:                    WindowPtr;
  184.         termRect:                Rect;
  185.         viewRect:                Rect;
  186.         visRect:                Rect;
  187.         lastIdle:                LONGINT;
  188.         selection:                TMSelection;
  189.         selType:                TMSelTypes;
  190.         mluField:                LONGINT;
  191.     END;
  192.  
  193.  
  194. CONST
  195.     uppTerminalSendProcInfo = $00002FF0;
  196.     uppTerminalBreakProcInfo = $000003C0;
  197.     uppTerminalCacheProcInfo = $000003F0;
  198.     uppTerminalSearchCallBackProcInfo = $00000EC0;
  199.     uppTerminalClikLoopProcInfo = $000000D0;
  200.     uppTerminalEnvironsProcInfo = $000003E0;
  201.     uppTerminalChooseIdleProcInfo = $00000000;
  202.     uppTerminalToolDefProcInfo = $0000FEF0;
  203.  
  204. FUNCTION NewTerminalSendProc(userRoutine: TerminalSendProcPtr): TerminalSendUPP;
  205.     {$IFC NOT GENERATINGCFM }
  206.     INLINE $2E9F;
  207.     {$ENDC}
  208.  
  209. FUNCTION NewTerminalBreakProc(userRoutine: TerminalBreakProcPtr): TerminalBreakUPP;
  210.     {$IFC NOT GENERATINGCFM }
  211.     INLINE $2E9F;
  212.     {$ENDC}
  213.  
  214. FUNCTION NewTerminalCacheProc(userRoutine: TerminalCacheProcPtr): TerminalCacheUPP;
  215.     {$IFC NOT GENERATINGCFM }
  216.     INLINE $2E9F;
  217.     {$ENDC}
  218.  
  219. FUNCTION NewTerminalSearchCallBackProc(userRoutine: TerminalSearchCallBackProcPtr): TerminalSearchCallBackUPP;
  220.     {$IFC NOT GENERATINGCFM }
  221.     INLINE $2E9F;
  222.     {$ENDC}
  223.  
  224. FUNCTION NewTerminalClikLoopProc(userRoutine: TerminalClikLoopProcPtr): TerminalClikLoopUPP;
  225.     {$IFC NOT GENERATINGCFM }
  226.     INLINE $2E9F;
  227.     {$ENDC}
  228.  
  229. FUNCTION NewTerminalEnvironsProc(userRoutine: TerminalEnvironsProcPtr): TerminalEnvironsUPP;
  230.     {$IFC NOT GENERATINGCFM }
  231.     INLINE $2E9F;
  232.     {$ENDC}
  233.  
  234. FUNCTION NewTerminalChooseIdleProc(userRoutine: TerminalChooseIdleProcPtr): TerminalChooseIdleUPP;
  235.     {$IFC NOT GENERATINGCFM }
  236.     INLINE $2E9F;
  237.     {$ENDC}
  238.  
  239. FUNCTION NewTerminalToolDefProc(userRoutine: TerminalToolDefProcPtr): TerminalToolDefUPP;
  240.     {$IFC NOT GENERATINGCFM }
  241.     INLINE $2E9F;
  242.     {$ENDC}
  243.  
  244. FUNCTION CallTerminalSendProc(thePtr: Ptr; theSize: LONGINT; refCon: LONGINT; flags: CMFlags; userRoutine: TerminalSendUPP): LONGINT;
  245.     {$IFC NOT GENERATINGCFM}
  246.     INLINE $205F, $4E90;
  247.     {$ENDC}
  248.  
  249. PROCEDURE CallTerminalBreakProc(duration: LONGINT; refCon: LONGINT; userRoutine: TerminalBreakUPP);
  250.     {$IFC NOT GENERATINGCFM}
  251.     INLINE $205F, $4E90;
  252.     {$ENDC}
  253.  
  254. FUNCTION CallTerminalCacheProc(refCon: LONGINT; theTermData: TermDataBlockPtr; userRoutine: TerminalCacheUPP): LONGINT;
  255.     {$IFC NOT GENERATINGCFM}
  256.     INLINE $205F, $4E90;
  257.     {$ENDC}
  258.  
  259. PROCEDURE CallTerminalSearchCallBackProc(hTerm: TermHandle; refNum: INTEGER; VAR foundRect: Rect; userRoutine: TerminalSearchCallBackUPP);
  260.     {$IFC NOT GENERATINGCFM}
  261.     INLINE $205F, $4E90;
  262.     {$ENDC}
  263.  
  264. FUNCTION CallTerminalClikLoopProc(refCon: LONGINT; userRoutine: TerminalClikLoopUPP): BOOLEAN;
  265.     {$IFC NOT GENERATINGCFM}
  266.     INLINE $205F, $4E90;
  267.     {$ENDC}
  268.  
  269. FUNCTION CallTerminalEnvironsProc(refCon: LONGINT; VAR theEnvirons: TermEnvironRec; userRoutine: TerminalEnvironsUPP): CMErr;
  270.     {$IFC NOT GENERATINGCFM}
  271.     INLINE $205F, $4E90;
  272.     {$ENDC}
  273.  
  274. PROCEDURE CallTerminalChooseIdleProc(userRoutine: TerminalChooseIdleUPP);
  275.     {$IFC NOT GENERATINGCFM}
  276.     INLINE $205F, $4E90;
  277.     {$ENDC}
  278.  
  279. FUNCTION CallTerminalToolDefProc(hTerm: TermHandle; msg: INTEGER; p1: LONGINT; p2: LONGINT; p3: LONGINT; userRoutine: TerminalToolDefUPP): LONGINT;
  280.     {$IFC NOT GENERATINGCFM}
  281.     INLINE $205F, $4E90;
  282.     {$ENDC}
  283. FUNCTION InitTM: TMErr;
  284. FUNCTION TMGetVersion(hTerm: TermHandle): Handle;
  285. FUNCTION TMGetTMVersion: INTEGER;
  286. FUNCTION TMNew({CONST}VAR termRect: Rect; {CONST}VAR viewRect: Rect; flags: TMFlags; procID: INTEGER; owner: WindowPtr; sendProc: TerminalSendUPP; cacheProc: TerminalCacheUPP; breakProc: TerminalBreakUPP; clikLoop: TerminalClikLoopUPP; environsProc: TerminalEnvironsUPP; refCon: LONGINT; userData: LONGINT): TermHandle;
  287. PROCEDURE TMDispose(hTerm: TermHandle);
  288. PROCEDURE TMKey(hTerm: TermHandle; {CONST}VAR theEvent: EventRecord);
  289. PROCEDURE TMUpdate(hTerm: TermHandle; visRgn: RgnHandle);
  290. PROCEDURE TMPaint(hTerm: TermHandle; {CONST}VAR theTermData: TermDataBlock; {CONST}VAR theRect: Rect);
  291. PROCEDURE TMActivate(hTerm: TermHandle; activate: BOOLEAN);
  292. PROCEDURE TMResume(hTerm: TermHandle; resume: BOOLEAN);
  293. PROCEDURE TMClick(hTerm: TermHandle; {CONST}VAR theEvent: EventRecord);
  294. PROCEDURE TMIdle(hTerm: TermHandle);
  295. FUNCTION TMStream(hTerm: TermHandle; theBuffer: UNIV Ptr; theLength: LONGINT; flags: CMFlags): LONGINT;
  296. FUNCTION TMMenu(hTerm: TermHandle; menuID: INTEGER; item: INTEGER): BOOLEAN;
  297. PROCEDURE TMReset(hTerm: TermHandle);
  298. PROCEDURE TMClear(hTerm: TermHandle);
  299. PROCEDURE TMResize(hTerm: TermHandle; {CONST}VAR newViewRect: Rect);
  300. FUNCTION TMGetSelect(hTerm: TermHandle; theData: Handle; VAR theType: ResType): LONGINT;
  301. PROCEDURE TMGetLine(hTerm: TermHandle; lineNo: INTEGER; VAR theTermData: TermDataBlock);
  302. PROCEDURE TMSetSelection(hTerm: TermHandle; {CONST}VAR theSelection: TMSelection; selType: TMSelTypes);
  303. PROCEDURE TMScroll(hTerm: TermHandle; dh: INTEGER; dv: INTEGER);
  304. FUNCTION TMValidate(hTerm: TermHandle): BOOLEAN;
  305. PROCEDURE TMDefault(VAR theConfig: Ptr; procID: INTEGER; allocate: BOOLEAN);
  306. FUNCTION TMSetupPreflight(procID: INTEGER; VAR magicCookie: LONGINT): Handle;
  307. PROCEDURE TMSetupSetup(procID: INTEGER; theConfig: UNIV Ptr; count: INTEGER; theDialog: DialogPtr; VAR magicCookie: LONGINT);
  308. FUNCTION TMSetupFilter(procID: INTEGER; theConfig: UNIV Ptr; count: INTEGER; theDialog: DialogPtr; VAR theEvent: EventRecord; VAR theItem: INTEGER; VAR magicCookie: LONGINT): BOOLEAN;
  309. PROCEDURE TMSetupItem(procID: INTEGER; theConfig: UNIV Ptr; count: INTEGER; theDialog: DialogPtr; VAR theItem: INTEGER; VAR magicCookie: LONGINT);
  310. PROCEDURE TMSetupXCleanup(procID: INTEGER; theConfig: UNIV Ptr; count: INTEGER; theDialog: DialogPtr; OKed: BOOLEAN; VAR magicCookie: LONGINT);
  311. PROCEDURE TMSetupPostflight(procID: INTEGER);
  312. FUNCTION TMGetConfig(hTerm: TermHandle): Ptr;
  313. FUNCTION TMSetConfig(hTerm: TermHandle; thePtr: UNIV Ptr): INTEGER;
  314. FUNCTION TMIntlToEnglish(hTerm: TermHandle; inputPtr: UNIV Ptr; VAR outputPtr: Ptr; language: INTEGER): OSErr;
  315. FUNCTION TMEnglishToIntl(hTerm: TermHandle; inputPtr: UNIV Ptr; VAR outputPtr: Ptr; language: INTEGER): OSErr;
  316. PROCEDURE TMGetToolName(id: INTEGER; VAR name: Str255);
  317. FUNCTION TMGetProcID(name: Str255): INTEGER;
  318. PROCEDURE TMSetRefCon(hTerm: TermHandle; refCon: LONGINT);
  319. FUNCTION TMGetRefCon(hTerm: TermHandle): LONGINT;
  320. PROCEDURE TMSetUserData(hTerm: TermHandle; userData: LONGINT);
  321. FUNCTION TMGetUserData(hTerm: TermHandle): LONGINT;
  322. FUNCTION TMAddSearch(hTerm: TermHandle; theString: Str255; {CONST}VAR where: Rect; searchType: TMSearchTypes; callBack: TerminalSearchCallBackUPP): INTEGER;
  323. PROCEDURE TMRemoveSearch(hTerm: TermHandle; refnum: INTEGER);
  324. PROCEDURE TMClearSearch(hTerm: TermHandle);
  325. FUNCTION TMGetCursor(hTerm: TermHandle; cursType: TMCursorTypes): Point;
  326. FUNCTION TMGetTermEnvirons(hTerm: TermHandle; VAR theEnvirons: TermEnvironRec): TMErr;
  327. FUNCTION TMChoose(VAR hTerm: TermHandle; where: Point; idleProc: TerminalChooseIdleUPP): INTEGER;
  328. PROCEDURE TMEvent(hTerm: TermHandle; {CONST}VAR theEvent: EventRecord);
  329. FUNCTION TMDoTermKey(hTerm: TermHandle; theKey: Str255): BOOLEAN;
  330. FUNCTION TMCountTermKeys(hTerm: TermHandle): INTEGER;
  331. PROCEDURE TMGetIndTermKey(hTerm: TermHandle; id: INTEGER; VAR theKey: Str255);
  332. PROCEDURE TMGetErrorString(hTerm: TermHandle; id: INTEGER; VAR errMsg: Str255);
  333. {$ENDC}
  334. {$ALIGN RESET}
  335. {$POP}
  336.  
  337. {$SETC UsingIncludes := TerminalsIncludes}
  338.  
  339. {$ENDC} {__TERMINALS__}
  340.  
  341. {$IFC NOT UsingIncludes}
  342.  END.
  343. {$ENDC}
  344.